package com.xiaoma.synchronzied;

/**
 * @author xiaomacdut
 * @date 2020年2月12日 下午5:24:22
 */
public class LockDemo{
    
    Lock lock = new Lock();
    
    public void demo() throws InterruptedException{
        lock.lock();
        System.out.println("demo");
        demo2();
        lock.unlock();
    }
    
    public void demo2() throws InterruptedException{
        lock.lock();
        System.out.println("demo2");
        lock.unlock();
    }
    
    public static void main(String [] args) throws InterruptedException{
        LockDemo demo = new LockDemo();
        demo.demo();
    }
}
